package com.adopapa.wechatapi;

import com.adopapa.wechatapi.application.service.EWechatApi;
import com.adopapa.wechatapi.enterprise.domain.activeMessage.ETextCustomerMessage;
import com.adopapa.wechatapi.enterprise.domain.activeMessage.ETextCustomerMessage.Text;

public class Main {
	
	public static void main(String[] args) throws Exception {
		double dd = 1.025d;
		double rr = Math.pow(dd, 10.0d);
		System.out.println(1.4 * rr);
		
		//AccessToken accessToken = ETokenManager.getInstance().getCachedAccessToken(AdminConstants.WECHAT_CORP_ID, AdminConstants.WECHAT_MAIN_CHAT_SECRET);
//		String accessToken = "Z-AktJdzmpB9tddGgwv_ZIBPl9Lwc8WKjUx_c2IkfpyOW_b9zapQFOxr9bhRhy1yhHgpFjZDKNT6wQN6mL4tgeko_6mkAXwUJLfb5EuQpqdlyAxwwXyFOKFPr4p2pa7UiLp1no6NxzsXodCrOPFNPig2zEEtU_vsIn8faMbDOqyzA2aWzpedW5Y7w7H5x7PEE2UWaYmn_3qUPXrhYCpBog";
//		System.out.println(accessToken);
//		ETextCustomerMessage message = new ETextCustomerMessage();
//		message.setAgentId(AdminConstants.WECHAT_DEFAULT_ADENT_ID);
//		message.setSafe("0");
//		//message.setToUser(memberUserInfo.getUserCode());
//		message.setToUser("C001|adopapa");
//		message.setText("您已经通过审核，正式成为管家会员，请遵守管家会员协议开展业务。");
//		System.out.println(message.toString());
//		boolean res = EWechatApi.sendMessage(accessToken.getToken(), message);
//		System.out.println(res);
		
//		AccessToken token = EWechatApi.getAccessToken("wx406ea2215654009e", "wiqO3efi23uhNxh7WKOTC-mAmqu__R5Fw5WNw38Kj30");
//		System.out.println(token);
//		String accessToken = token.getToken();
//		String accessToken = "TdKAdTSDmWF4a27W2eus2o5IvCC-eq8i9tcSvE9BEGwpztiEH0KvwlGGxnpjJDUbLdWc99KBBDrfo3WfLM64cO76YS3SaNS3W7JRGqlOP0vEGtf718FqWmvq8JDjnJz83lvdcf0zZtc619qr-s-naXspCeprfTGEEjXFaArefXxMu5l5dMKVhRDkEllqbVwPH2gKad-R4LKtPxiJWx4rtw";
//		System.out.println(accessToken);
//		Chat chat = new Chat();
//		chat.setChatId("12345678");
//		chat.setName("测试会话");
//		chat.setOwner("ZhangDaShu");
//		chat.setUserList(new String[] {"F001", "ZhangDaShu"});
//		
//	        boolean res =	EWechatApi.createChat(accessToken, chat);
//	        System.out.println(res);
		
////		chat.setDelUserList(new String[]{"d123456"});
//		chat.setAddUserList(new String[] {"d123456"});
//		chat.setOperator("F001");
//		boolean updateChat = EWechatApi.updateChat(accessToken, chat);
//	        System.out.println(updateChat);
//	        
//	        EnterpriseResult result = EWechatApi.getChat(accessToken, "123456");
//	        System.out.println(result.getChatInfo());
	        
		
//		ChatMessage message = new ChatMessage();
//		Receiver receiver = new Receiver(ChatMessage.CHAT_RECEIVER_GROUP_TYPE, "123456");
//		message.setReceiver(receiver);
//		message.setSender("F001");
//		Text text = new Text();
//		text.setContent("利用接口发送测试消息");
//		message.setText(text);
//		message.setMessageType(ChatMessage.CHAT_TEXT_MESSAGE_TYPE);
//		boolean sendChatMessage = EWechatApi.sendChatMessage(accessToken, message);
//		System.out.println(sendChatMessage);
	        
//	    AccessToken token = EWechatApi.getAccessToken("wx406ea2215654009e", "wiqO3efi23uhNxh7WKOTC-mAmqu__R5Fw5WNw38Kj30");
//	    System.out.println(token);
//		String accessToken = token.getToken();
		String accessToken = "u8x3JskbVNNwGlTkA9mkbtP4bJfR08S4U6tmeCSm2YRYSf0EYMqOFxmcRK9EjQ8lKgxnJToqAIaV52HKFLfn2pLZK0-snI2I3Xnmou3LlxtyZgUH5i-ViIQwTKn2jarUAx_ziDFsHMkHunM4rfz5EiL_uXqP3YBt9OUc1w1Go5OG1MYWnzFuagoU2qrWDoZbgicWsmyKH9mRiDv-Q7qYlw";
		
		
		ETextCustomerMessage customerMessage = new ETextCustomerMessage();
		customerMessage.setAgentId(0);
		Text text = new Text("测试");
		customerMessage.setText(text);
		customerMessage.setToUser("F001|ZhangDaShu");
		boolean sendMessage = EWechatApi.sendMessage(accessToken, customerMessage);
	    System.out.println(sendMessage);
	    
	}

}